<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>背景</title>
    <style>
        .clip-img{
            width: 200px;
            height: 200px;
            margin:100px auto;
            background-color: yellow;
            border: 5px dashed red;
            padding:20px;
        }

        .clip-img:nth-child(2){
            background-clip: content-box;
        }

        .clip-img:nth-child(3){
            background-clip: padding-box;
        }

        .clip-img:nth-child(4){
            background-clip: border-box;
        }
    </style>
</head>
<body>
<div class="clip-img">
    正常
</div>

<div class="clip-img">
    background-clip: content-box;
</div>

<div class="clip-img">
    background-clip: padding-box;
</div>

<div class="clip-img">
    默认的<br>
    background-clip: border-box;
</div>
</body>
</html>